package com.craterhill.java.ccp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.craterhill.java.ccp.common.beans.College;
import com.craterhill.java.ccp.dao.impl.AbstractDao;
import com.craterhill.java.ccp.dao.utils.CCPResultSetExtractor;

public interface CollegesDao extends CCPDao<College> {

	public final String FIELD_LIST = "obj.college_id, obj.college_name" + AbstractDao.MONITER_FIELDS;
	public final String FIND_ALL_COLLEGES = "select " + FIELD_LIST + " from colleges obj";

	public final class CollegesExtractor extends CCPResultSetExtractor<College> {
		@Override
		protected College extractResultSetData(ResultSet resultSet) throws SQLException {
			College colleges = new College();
			colleges.setCollegeId(resultSet.getInt(1));
			colleges.setCollegeName(resultSet.getString(2));
			colleges.setStatus(resultSet.getBoolean(3));
			colleges.setCreatedBy(resultSet.getInt(4));
			colleges.setModifiedBy(resultSet.getInt(5));
			colleges.setCreatedDate(resultSet.getDate(6));
			colleges.setModifiedDate(resultSet.getDate(7));
			return colleges;
		}
	}
}